import {http} from "@/utils/request.js"

// 获取购物车信息
export const getShoppingList = () => {
	return http({
		url: '/shopping/list',
		method: 'GET'
	})
}

// 新增商品到购物车
export const addShopping = (goodId) => {
	return http({
		url: '/shopping/add',
		method: 'POST',
		data: {
			goodId
		}
	})
}

// 修改购物车商品
export const updateShopping = (data) => {
	return http({
		url: '/shopping/update',
		method: 'PUT',
		data: data
	})
}

// 删除购物车商品
export const deleteShopping = (id) => {
	return http({
		url: '/shopping/deleteList',
		method: 'DELETE',
		data: {
			id
		},
		header: {
			'content-type': 'application/x-www-form-urlencoded'
		}
	})
}